import request from '@/utils/request'

// 获取部门列表
export function fetchDepartmentList() {
  return request({
    method: 'get',
    url: '/company/department'
  })
}

// 获取下拉框负责人数据
export function fetchManagerList() {
  return request({
    method: 'get',
    url: '/sys/user/simple'
  })
}

// 新增部门列表
export function fetchAddDepart(data) {
  return request({
    url: '/company/department',
    method: 'post',
    data
  })
}

// 删除部门
export function fetchDelDepart(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'delete'

  })
}

// 获取部门详情回填
export function fetchDetail(id) {
  return request({
    url: `/company/department/${id}`
  })
}

// 更新部门详情
export function fetchUpdateDepart(data) {
  return request({
    url: `/company/department/${data.id}`,
    method: 'put',
    data
  })
}

// 封装获取角色列表接口

export function fetchRoleList(params) {
  return request({
    url: '/sys/role',
    params
  })
}

// 封账删除角色
export function fetchDelRole(id) {
  return request({
    method: 'delete',
    url: `/sys/role/${id}`
  })
}

// 新增接口列表
export function fetchaddRole(data) {
  return request({
    url: '/sys/role',
    method: 'post',
    data
  })
}
